package com.burgeon.backend.SHOPBACKEND.controller;

import com.burgeon.backend.SHOPBACKEND.entity.CouponGift;
import com.burgeon.backend.SHOPBACKEND.entity.PlusActiveConfiguration;
import com.burgeon.backend.SHOPBACKEND.entity.PlusApplyRecord;
import com.burgeon.backend.SHOPBACKEND.entity.presell.PresellConfig;
import com.burgeon.backend.SHOPBACKEND.service.BackendPlusActiveService;
import com.burgeon.backend.stsutil.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;

@RequestMapping("backend/plus")
@RestController
@CrossOrigin
public class BackendPlusActiveController extends BaseController {

    @Autowired
    private BackendPlusActiveService backendPlusActiveService;


    /**
     *
     * 购买记录
     * token ：必传
     *
     * flag: p:手机号   d:激活店铺
     *
     * phone:手机号
     * store：店铺
     *
     * startDate：开始时间
     *
     * endDate:结束时间
     *
     * */
    @RequestMapping("getData")
    public ResponseResult<List<PlusApplyRecord>> getData(String token, String flag, String startDate, String endDate, String phone , String store,int start){
        List<PlusApplyRecord> data = backendPlusActiveService.getData(token,flag,startDate,endDate,phone,store,start);
        return new ResponseResult<List<PlusApplyRecord>>(SUCCESS,data);
    }

    //添加/修改plus会员配置
    @RequestMapping("addPlusActive")
    public ResponseResult<Void> addPlusActive(PlusActiveConfiguration plusActiveConfiguration){
        backendPlusActiveService.addPlusActive(plusActiveConfiguration);
        return new ResponseResult<Void>(SUCCESS);
    }

    /**
     * @author: 伯俊软件
     * @description: Plus活动配置回显
     * @date: 2021/6/21 15:58
     * @param token
     * @return com.burgeon.backend.stsutil.ResponseResult<com.burgeon.backend.SHOPBACKEND.entity.PlusActiveConfiguration>
     */
    @RequestMapping("showPlusActive")
    public ResponseResult<PlusActiveConfiguration> showPlusActive(String token){
        PlusActiveConfiguration data = backendPlusActiveService.showPlusActive(token);
        return new ResponseResult<PlusActiveConfiguration>(SUCCESS,data);
    }

    //每月神券、无门槛券
    @RequestMapping("getCouponGift")
    public ResponseResult<List<CouponGift>> getCouponGift(String token){
        List<CouponGift> data = backendPlusActiveService.getCouponGift(token);
        return new ResponseResult<List<CouponGift>>(SUCCESS,data);
    }



}
